/* eslint-disable */
/* prettier-ignore */
// @js-nocheck
import pluginVue from 'eslint-plugin-vue'
import vueTsEslintConfig from '@vue/eslint-config-typescript'
import oxlint from 'eslint-plugin-oxlint'
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
import { FlatCompat } from '@eslint/eslintrc'
import { readFile } from 'fs'
import path, { join } from 'path'
import { fileURLToPath } from 'node:url'

const __dirname = path.dirname(fileURLToPath(import.meta.url))
let autoImportConfig = { globals: {} }
readFile(join(__dirname, '.eslintrc-auto-import.json'), { encoding: 'utf8' }, (string) => {
  autoImportConfig = JSON.parse(string)
})
const compat = new FlatCompat({ baseDirectory: __dirname })

export default [
  {
    name: 'app/files-to-lint',
    files: ['**/*.{ts,mts,tsx,vue}'],
  },
  {
    name: 'app/files-to-ignore',
    ignores: [
      '**/dist/**',
      '**/dist-ssr/**',
      '**/coverage/**',
      'eslint.config.js',
      '*.d.ts',
      'dev-dist/*.js',
      'node_modules/**',
    ],
  },
  {
    languageOptions: {
      // globals: { ...globals.browser, ...globals.node, ...autoImportConfig.globals },
      globals: { ...autoImportConfig.globals },
    },
  },

  ...pluginVue.configs['flat/essential'],
  ...vueTsEslintConfig(),
  oxlint.configs['flat/recommended'],
  skipFormatting,
  ...compat.extends('./.eslintrc-auto-import.json'),
  {
    rules: {
      '@typescript-eslint/no-unused-expressions': 'off',
      'vue/multi-word-component-names': 'off',
    },
  },
]
